<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <body>

        <ui:composition template="./WEB-INF/templates/template.xhtml">
            <ui:define name="content">
                <f:loadBundle basename="org.inftel.scrum.message.Messages" var="msg"/>

                <div class="grid_16">
                    <div class= "grid_8">
                        <h2>#{msg.sprintPlaningtitle}</h2>
                        <h:form id="form" styleClass="prime-component table">
                            <p:growl id="growl" showDetail="true" life="3000" />
                            <p:pickList value="#{sprintPlaningBean.tareas}"  
                                        var="task" 
                                        itemLabel="#{task.description}"
                                        itemValue="#{task}"
                                        style="text-align:center;" 
                                        styleClass="prime-component"
                                        id="pickList">
                                <f:facet name="sourceCaption">#{msg.sprintPlaningtitle1picklist}</f:facet>  
                                <f:facet name="targetCaption">#{msg.sprintPlaningtitle2picklist}</f:facet>  


                            </p:pickList>

                            <h:panelGrid columns="2" cellpadding="5">  
                                <p:commandButton id="effectsDialogButton" value="#{msg.sprintPlaningbuttonNewTask}" onclick="dlg.show();" type="button" styleClass="button" />  
                                <p:commandButton id="userSubmit" value="#{msg.sprintPlaningbuttonSubmit}"  action="#{sprintPlaningBean.modify()}" styleClass="button" update=":tasks:selecTask :form:growl"/>
                            </h:panelGrid>         
                        </h:form>
                    </div>
                    <div class="grid_8">
                        <h2>Asignar Usuario</h2>
                        <div class="box">
                            
                            <h:form id="tasks" styleClass="prime-component">
                                <h:panelGrid styleClass="table" columns="2" style="margin-bottom:10px">

                                    <h:outputLabel for="selecTask" value="Tarea: "/>
                                    <p:selectOneMenu id="selecTask" value="#{sprintPlaningBean.task}" converter="#{taskConverter}" style="width: 220px">
                                        <!--                            <f:selectItem itemLabel="Select One" itemValue=""/>-->
                                        <f:selectItems value="#{sprintPlaningBean.tasks}" var="task"  itemLabel="#{task.description}" itemValue="#{task}"/>
                                    </p:selectOneMenu>

                                    <h:outputLabel value="Usuario: "/>
                                    <p:selectOneMenu value="#{sprintPlaningBean.user}"  converter="#{userConverter}" style="width: 220px">
                                        <!--                            <f:selectItem itemLabel="Select One" itemValue=""/>-->
                                        <f:selectItems value="#{sprintPlaningBean.users}" var="user" itemLabel="#{user.name}" itemValue="#{user}"/>
                                    </p:selectOneMenu>

                                    <h:inputHidden/>
                                    <h:panelGroup>
                                            <p:commandButton id="guardar" value="#{msg.sprintPlaningbuttonSubmit}" type="button" actionListener="#{sprintPlaningBean.addTaskUser()}" styleClass="button" />
                                            <p:commandButton id="borrar" value="#{msg.sprintPlaningbuttonDelete}" type="button" actionListener="#{sprintPlaningBean.deleteTask()}" styleClass="button" />
                                    </h:panelGroup>

                                </h:panelGrid>

                            </h:form>
                        </div>

                        <p:dialog header="#{msg.sprintPlaningbuttonNewTask}" modal="true" resizable="false" widgetVar="dlg" showEffect="explode" hideEffect="explode" styleClass="prime-component button">  
                            <h:form id="formTask" styleClass="prime-component table"  >
                                <p:messages id="messages"/>
                                <h:panelGrid columns="2" style="table-layout: auto">  
                                    <h:outputLabel for="descripcion" value="#{msg.sprintPlaningDlgDescription}" />  
                                    <h:inputTextarea id="descripcion" value="#{sprintPlaningBean.descripcion}" required="true"/> 
                                    <h:outputLabel for="time" value="#{msg.sprintPlaningDlgTime}" />  
                                    <p:inputText id="time" value="#{sprintPlaningBean.time}"  /> 

                                </h:panelGrid>  

                                <p:commandButton id="submitButton" value="#{msg.sprintPlaningbuttonSubmit}" update=":form:pickList, :form:growl"   actionListener="#{sprintPlaningBean.addTaskToList(actionEvent)}" styleClass="button" oncomplete="dlg.hide();"/>  

                            </h:form>  
                        </p:dialog> 
                    </div>

                    <div class="clear"></div>
                </div>
                <div class="clear"></div>

            </ui:define>

        </ui:composition>

    </body>
</html>
